package main

import (
	"fmt"
	"github.com/beego/beego/v2/core/validation"
	"huijing_mall/internal/cachebase"
	"huijing_mall/internal/database"
	"huijing_mall/pkg/logger"
	"huijing_mall/pkg/vipercfg"
	"huijing_mall/router"
	"huijing_mall/server"
	"huijing_mall/variable"
	"math/rand"
	"time"
)

var Version = "0.0.01"

//	@title			灰鲸商城系统API文档
//	@version		0.01
//	@description	灰鲸商城系统API文档

//	@host		localhost:9091
//	@BasePath	/

// @securityDefinitions.apikey	Token
// @in							header
// @name						Token
func main() {
	//暂时 使用beego框里面的验证器吧 ☺☺☺☺
	variable.Valid = validation.Validation{}
	rand.Seed(time.Now().UnixNano())
	logger.LogInit()
	cfg := vipercfg.ViperInit("")

	logger.Info(fmt.Sprintf("Version：%v", Version))
	// 程序的正常逻辑
	logger.Info("Working...")
	server.Run(
		cfg.ServerPort,
		database.MysqlCfg(cfg.Database),
		cachebase.InitRedis(cfg.CacheBase), cfg.RabbitMQ,
		router.Router,
	)
}
